package spring.boot.btc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import spring.boot.btc.model.Wallet;
import spring.boot.btc.service.WalletService;

@Controller
public class IndexController {

    @Autowired
    private WalletService walletService;

    @GetMapping("/")
    public String index(Model model) {
        model.addAttribute("address", Wallet.getInstance().getAddress());
        model.addAttribute("balance", walletService.getBalance());
        return "index";
    }
}
